import { axios } from "../../utils/request";

const api = {
    DefineFieldList: "/crm/defineField/list",
    DefineFieldSaveVal: "/crm/defineField/saveFieldVal",
    DefineFieldSave: "/crm/defineField/save",
    ChangeOnLocked: "/crm/defineField/changeOnLocked",
    DefineFieldBatchSave:"/crm/defineField/batchSaveField",
    DefineFieldDelete:"/crm/defineField/delete",
    StrategyList: "/crm/strategy/list",
    StrategySave: "/crm/strategy/save",
    StrategyVal: "/crm/strategy/getStrategyVal",
    CodeList: "/crm/code/list",
    CodeSave: "/crm/code/save",
};

/**
 * 获取 系統自定义字段
 * parameter: {
 *      current: 1,
 *      size:20,
 *      source: ''
 * }
 * @param parameter
 * @returns {*}
 */
export function SysFieldPage(parameter) {
  return axios({
    url: api.SysFieldPage,
    method: "get",
    params: parameter
  });
}

/**
 * 新增/修改 系統自定义字段
 * @param {*} data
 */
export function SysFieldSave(data) {
  return axios({
    url: api.SysFieldSave,
    method: "post",
    data: data
  });
}

/**
 * 批量 新增/修改 系統自定义字段
 * @param {*} data
 */
export function DefineFieldBatchSave(data) {
  return axios({
    url: api.DefineFieldBatchSave,
    method: "post",
    data: data
  });
}

/**
 * 删除 自定义字段
 */
export function DefineFieldDelete(id) {
  return axios({
    url: api.DefineFieldDelete,
    method: "DELETE",
    params: id
  });
}


/**
 * 获取 客户自定义字段
 * parameter: {
 *      source: ''
 * }
 * @param parameter
 * @returns {*}
 */
export function DefineFieldList(parameter) {
    return axios({
      url: api.DefineFieldList,
      method: "get",
      params: parameter
    });
  }
  
  /**
   * 新增/修改 客户自定义字段
   * @param {*} data
   */
  export function DefineFieldSave(data) {
    return axios({
      url: api.DefineFieldSave,
      method: "post",
      data: data
    });
  }
  /**
   * 锁定/解锁 基础字段
   * @param {*} data 
   */
  export function ChangeOnLocked(data) {
    return axios({
      url: api.ChangeOnLocked,
      method: "post",
      data: data
    });
  }
/**
 * 获取 客户编码
 * @param parameter
 * @returns {*}
 */
export function CodeList(parameter) {
    return axios({
      url: api.CodeList,
      method: "get",
      params: parameter
    });
  }
  
  /**
   * 新增/修改 客户编码
   * @param {*} data
   */
  export function CodeSave(data) {
    return axios({
      url: api.CodeSave,
      method: "get",
      params: data
    });
  }

  /**
 * 获取 客户策略
 * @param parameter
 * @returns {*}
 */
export function StrategyList(parameter) {
    return axios({
      url: api.StrategyList,
      method: "get",
      params: parameter
    });
  }
  
  /**
   * 新增/修改 客户策略
   * @param {*} data
   */
  export function StrategySave(data) {
    return axios({
      url: api.StrategySave,
      method: "post",
      data: data
    });
  }

  /**
   * 获取策略值
   */
  export function StrategyVal(data) {
    return axios({
      url: api.StrategyVal,
      method: "get",
      params: data
    });
  }